package com.smartboard.network.ui;

import android.content.Context;
import android.graphics.Point;
import android.support.v7.app.AppCompatDialog;
import android.view.Display;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Toast;

/**
 * Created by cheas on 2018/8/24.
 */

public class BaseDialog extends AppCompatDialog {
    public BaseDialog(Context context) {
        super(context);
    }

    protected void adjustWindowSize() {
        Window win = getWindow();
        WindowManager m = win.getWindowManager();
        Display d = m.getDefaultDisplay();
        Point size = new Point();
        d.getSize(size);
        win.setLayout((int)(size.x * 0.95), WindowManager.LayoutParams.WRAP_CONTENT);
    }

    protected void showToast(final int id) {
        Toast.makeText(getContext(), id, Toast.LENGTH_SHORT).show();
    }
}
